const express = require('express');

const app = express();

//创建路由规则
//requst 是对请求报文的封装
//response 是对响应报文的封装
app.get('/server',(request,response)=>{
    //设置响应头
    response.setHeader('Access-Control-Allow-Origin','*');
    //设置响应体        
    response.send('HELLO,AJAX');
});
app.post('/server',(request,response)=>{
    //设置响应头
    response.setHeader('Access-Control-Allow-Origin','*');//解决跨域问题
    //设置响应体        
    response.send('HELLO,AJAX POST');
});

app.listen(3000,()=>{
    console.log('服务已经启动,3000端口监听中......');
    
})
